/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.yogi.webframework.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Yogi
 */
@Entity
@Table(name = "t_product_part")
@NamedQueries({
    @NamedQuery(name = "ProductPart.findAll", query = "SELECT p FROM ProductPart p"),
    @NamedQuery(name = "ProductPart.findByNum", query = "SELECT p FROM ProductPart p WHERE p.num = :num"),
    @NamedQuery(name = "ProductPart.findByImageSrc", query = "SELECT p FROM ProductPart p WHERE p.imageSrc = :imageSrc"),
    @NamedQuery(name = "ProductPart.findByJarumLeft", query = "SELECT p FROM ProductPart p WHERE p.jarumLeft = :jarumLeft"),
    @NamedQuery(name = "ProductPart.findByJarumTop", query = "SELECT p FROM ProductPart p WHERE p.jarumTop = :jarumTop")})
public class ProductPart implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "NUM")
    private Integer num;
    @Column(name = "IMAGE_SRC")
    private String imageSrc;
    @Column(name = "JARUM_LEFT")
    private Integer jarumLeft;
    @Column(name = "JARUM_TOP")
    private Integer jarumTop;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "productPart")
    private List<OrdoDetail> ordoDetailList;
    @JoinColumns({
        @JoinColumn(name = "T_PRODUCT_IMAGES_ANGLE", referencedColumnName = "ANGLE"),
        @JoinColumn(name = "T_PRODUCT_IMAGES_T_PRODUCT_ID", referencedColumnName = "T_PRODUCT_ID")})
    @ManyToOne(optional = false)
    private ProductImages productImages;

    public ProductPart() {
    }

    public ProductPart(Integer num) {
        this.num = num;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public String getImageSrc() {
        return imageSrc;
    }

    public void setImageSrc(String imageSrc) {
        this.imageSrc = imageSrc;
    }

    public Integer getJarumLeft() {
        return jarumLeft;
    }

    public void setJarumLeft(Integer jarumLeft) {
        this.jarumLeft = jarumLeft;
    }

    public Integer getJarumTop() {
        return jarumTop;
    }

    public void setJarumTop(Integer jarumTop) {
        this.jarumTop = jarumTop;
    }

    public List<OrdoDetail> getOrdoDetailList() {
        return ordoDetailList;
    }

    public void setOrdoDetailList(List<OrdoDetail> ordoDetailList) {
        this.ordoDetailList = ordoDetailList;
    }

    public ProductImages getProductImages() {
        return productImages;
    }

    public void setProductImages(ProductImages productImages) {
        this.productImages = productImages;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (num != null ? num.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProductPart)) {
            return false;
        }
        ProductPart other = (ProductPart) object;
        if ((this.num == null && other.num != null) || (this.num != null && !this.num.equals(other.num))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.yogi.webframework.model.ProductPart[num=" + num + "]";
    }

}
